
module.exports = function ($scope, $state, $stateParams,$resource,$modal,items,$modalInstance,FileUploader) {
    console.log(items);
    $scope.a={};
    $scope.info={};

    $scope.applyarr=[
        {name:'区县项目',value:'0'},
        {name:'市级项目',value:'1'},
    ]
    // 责任处室
    $scope.officeFileArr = [
      {name:'规划发展处',value:'3', id : ['8', '9']},
      {name:'行业管理处  ',value:'6', id : ['3', '4']},
      {name:'人事编制处 ',value:'1', id : ['1', '2']},
      {name:'政策法规处 ',value:'2', id : ['3', '4']},
      {name:'区域合作处',value:'4', id : ['5', '6', '7']},
      {name:'市场开发处 ',value:'5', id : ['1', '2']},
      {name:'产业发展处',value:'7', id : ['8', '9']},
      {name:'特色旅游处',value:'8', id : ['5', '6', '7']},
      {name:'旅游质量监督管理所',value:'9', id : ['3', '4']},
      {name:'旅游产业发展服务中心',value:'10', id : ['8', '9']},
      {name:'机关党委',value:'11', id : ['5', '6', '7']},
      {name:'办公室',value:'12', id : ['5', '6', '7']}
  ]
    $scope.obj = {
      'isSelected' : false
    }
    $scope.image = function(){
				var para = $state.get('app.imageupload');
				//设置上传文件夹，以自己业务命名
				angular.extend(para, {
					resolve : {  
						'dir' : function(){
							return 't1';
						}
					} 
				})
				console.log(para);
				var modalInstance = $modal.open(para);
				modalInstance.opened.then(function() {// 模态窗口打开之后执行的函数  
					console.log('modal is opened');  
				});  
				modalInstance.result.then(function(result) {  
					console.log(result);  
          $scope.array = result;
          $scope.info.guide_pdf = $scope.array.join(',');
          console.log($scope.info.guide_pdf);
				}, function(reason) {  
					console.log(reason);// 点击空白区域，总会输出backdrop  
					// click，点击取消，则会暑促cancel 
					$log.info('Modal dismissed at: ' + new Date());  
				}); 
		};
    $scope.del=function(index){
        $scope.array.splice(index,1);
        console.log($scope.array);
        $scope.info.guide_pdf=$scope.array.join(',');
        console.log($scope.info.guide_pdf);
    }

    $scope.submit = function(){
        if($scope.obj.isSelected == false){
            $scope.info.city_project = '0';
        } else {
          $scope.info.city_project = '1';
        }
        $resource('/api/as/goc/reviewGuide/create', {}, {}).save($scope.info, function(res){
            // console.log(res);
            if(res.errcode === 0){                      
                alert('提交成功');  
                $modalInstance.close();
            }else{
                alert(res.errmsg);
            }
        });
    }

};
